import React, { Component } from 'react'
import { get } from './utils/request'
const url =
  '/film/api/v1/getNowPlayingFilmList?cityId=110100&pageNum=1&pageSize=10'

class App extends Component {
  state = {
    films: []
  }

  async componentDidMount() {
    let ret = await get(url)
    this.setState({
      films: ret.data.films
    })
  }

  render() {
    return (
      <div>
        <h3>电影列表展示</h3>
        <hr />
        <ul>
          {this.state.films.map((item) => (
            <li key={item.filmId}>{item.name}</li>
          ))}
        </ul>
      </div>
    )
  }
}

export default App
